package day0714;

import java.util.Arrays;

public class Test3 {
    public static void main(String[] args) {
        int[]  b={8,4,2,1};
        sort(b);
        System.out.println(Arrays.toString(b));
    }



    static void  sort(int[] a){
        for(int j=1; j<=3; j++) {
            for (int i = 0; i < a.length - j; i++) {
                if(a[i]>a[i+1]){
                    int temp = a[i];
                    a[i] = a[i + 1];
                    a[i + 1] = temp;
                }
            }
        }
        System.out.println(Arrays.toString(a));//1,2,4,8
    }

}
